<template>

	<view class="wrap">
		<myScan ref="myScan" v-if="scanCodeIsShow" @scanCode="scanCode"></myScan>
		<ErrDialog v-if="errDialogOpen" ref="errDialog" :dialogData="dialogData" @retryFunciton="retryFunciton">
		</ErrDialog>
		<!-- <u-button style="" @click="testErrdialog">testErrdialog</u-button> -->
		<u-tabs :list="list" :current="current" @change="change"></u-tabs>
		<!-- 当前套餐 -->
		<view v-if="current === 0" style="padding-bottom: 120rpx;">
			<view class="example-body">
				<!-- <u-form-item label="入库工作站" label-width="170" right-icon="arrow-right">
					<u-input placeholder="请选择" v-model="GZTID" @click="gzzShow = true" class="form-field-select" />
					<u-action-sheet border-radius='20' :list="gztList" v-model="gzzShow"
						@click="changeGzt"></u-action-sheet>
				</u-form-item> -->

				<!-- <u-form-item label="单据列表" label-width="170" right-icon="arrow-right">
					<u-input placeholder="去列表选择" type="button" @click="navTo('/pages/sys/storage/list')"
						class="form-field-select" />
				</u-form-item> -->
				<u-form-item label="入库单号" label-width="170" right-icon="">
					<!-- <u-input v-model="inbillNo" placeholder="请输入入库单号或扫码" style="width: 80%;" /> -->
					<uni-easyinput v-model="inbillNo" placeholder="请输入入库单号或扫码" style="margin-right: 10rpx;"
						@click="changeScanInput('inbillNo')"></uni-easyinput>
					<u-button @click="navTo('/pages/sys/storage/list')">选择</u-button>
				</u-form-item>
				<u-form-item label="商品信息" label-width="170" right-icon="">
					<!-- <u-input v-model="goods" placeholder="请输入商品信息" style="width: 80%;" /> -->
					<uni-easyinput v-model="goods" placeholder="请输入商品信息" style="margin-right: 10rpx;"></uni-easyinput>
					<u-button type="primary" @click="searchMx">搜索</u-button>
				</u-form-item>
				<!-- <u-gap height="20" bg-color="#f5f5f5"></u-gap> -->
			</view>
			<!-- <view class="search">
				<u-search input-align="center"
				height="70" v-model="goods" placeholder="请输入商品信息"
					@custom='searchMx'></u-search>
			</view> -->
			<u-empty v-if="!mxList.length" text="无明细数据,请尝试去单据列表选择一个新的单据" mode="page"></u-empty>
			<u-card v-for="(item, index) in mxList" class="task-list-item" :border="false" padding="20" margin="20rpx"
				@click="goTo(item,index)">
				<view slot="head" style="display: flex;align-items: center;justify-content: space-between;">
					<view style="display: flex;align-items: center;font-size: 30rpx;">
						<!-- <image class="user-images" src="/static/aidex/images/user06.png"></image> -->
						{{index+1}}.{{item.GDNAME}}
					</view>
					<view style="color: #999999;font-size: 22rpx;">{{item.BATCHNO}}</view>
					<uni-icons style="float: right;" type="forward" size="13"></uni-icons>
				</view>
				<view class="" slot="body">
					<u-row gutter="16">
						<u-col span="12">
							<view class="apply-text"><span>采购单：</span>{{item.INPAGENO}}</view>
						</u-col>
						<u-col span="12">
							<view class="apply-text"><span>业务单号：</span>{{item.INPAGENO_YW}}</view>
						</u-col>
						<u-col span="12">
							<view class="apply-text"><span>已收/总数量：</span>{{item.SHIS_AMOUNT}} / {{item.AMOUNT}}</view>
						</u-col>
					</u-row>
				</view>
				<!-- <view class="apply-list-foot" slot="foot" :style="overStyle(item.over)">
					{{item.over? "入库完成":"未入库"}}
				</view> -->
			</u-card>
			<u-loadmore :status="status" />
			<u-row gutter="32" class="more-bottom-box" justify="center">
				<u-col span="10">
					<view>
						<u-button class="more-button" type="primary" shape="circle"
							@click="scan1('inbillNo')">扫入库单</u-button>
					</view>
				</u-col>
			</u-row>
		</view>
		<view v-if="current === 1" class="example-body" style="padding-bottom: 140rpx;">
			<view>
				<u-form class="form-padding-bottom">
					<u-form-item label="扫描输入" ref="scanAll" label-width="170" right-icon="">
						<u-input @click="changeScanInput('form.scanAll')" @confirm="resolutionScan"
							v-model="form.scanAll" :focus="scanAllFocus" placeholder="请扫描二维码进行数据填充" />
						<u-button size="mini" shape="circle" @click="scan1('form.scanAll')">扫描</u-button>
					</u-form-item>
					<u-form-item label="上游编码" label-width="170" right-icon="">
						<u-input v-model="oneMx.GDSEQ" @blur="blurFunction" :disabled="disableTrue"
							placeholder="上游编码" />
					</u-form-item>
					<u-form-item label="商品编码" label-width="170" right-icon="">
						<u-input v-model="oneMx.GOODSID" @blur="blurFunction" :disabled="disableTrue"
							placeholder="商品编码" />
					</u-form-item>
					<u-form-item label="商品名称" label-width="170" right-icon="">
						<u-input v-model="oneMx.GDNAME" :title="oneMx.GDNAME" @blur="blurFunction"
							:disabled="disableTrue" placeholder="商品名称" />
					</u-form-item>
					<u-form-item label="商品厂家" label-width="170" right-icon="">
						<u-input v-model="oneMx.PRODUCER" :title="oneMx.PRODUCER" @blur="blurFunction"
							:disabled="disableTrue" placeholder="商品名称" />
					</u-form-item>
					<!-- @blur="blurFunction" -->
					<u-form-item label="已收/总数量" label-width="170" right-icon="">
						<u-input v-model="oneMx.SHIS_AMOUNT" :title="oneMx.SHIS_AMOUNT" :disabled="disableTrue"
							placeholder="已收" />
						<!-- <view style="color: #999999;display: inline;">/</view> -->
						/
						<u-input v-model="oneMx.AMOUNT" :title="oneMx.AMOUNT" @blur="blurFunction"
							:disabled="disableTrue" placeholder="总数量" />
					</u-form-item>




					<u-form-item label="批号" label-width="170" right-icon="">
						<u-input v-model="oneMx.BATCHNO" @blur="blurFunction" placeholder="请输入批号" />
					</u-form-item>
					<u-form-item label="生产日期" label-width="170" right-icon="arrow-right">
						<u-calendar v-model="calendaShow" mode="date" @change="changeProductDate"></u-calendar>
						<u-input v-model="oneMx.PRODUCTDATE" @click="calendaShow = true" placeholder="请输入生产日期" />
					</u-form-item>
					<u-form-item label="有效期" label-width="170" right-icon="arrow-right">
						<u-calendar v-model="calendaEffdateShow" mode="date" max-date="9999-01-01"
							@change="changeEFFDATE"></u-calendar>
						<u-input v-model="oneMx.EFFDATE" @click="calendaEffdateShow = true" placeholder="请输入有效期" />
					</u-form-item>

					<!-- <u-form-item label="货位" label-width="170" right-icon="">
						<u-input v-model="sjLocation" @blur="blurFunction"  placeholder="请输入货位" />
						<u-button @click="scan1('LOCATIONZD')">扫码</u-button>

					</u-form-item> -->
					<u-form-item label="入库点" label-width="170" right-icon="">
						<!-- <u-input v-model="landpoint" placeholder="请输入入库点" /> -->
						<uni-data-select @showSelector="showSelector($event)" placeholder="请选择线入库点" clear
							v-model="form.landpoint" :localdata="landpointList"
							@change="changeLandpoint"></uni-data-select>
					</u-form-item>
					<u-form-item label="托盘号" label-width="170" right-icon="">
						<u-input @click="changeScanInput('form.tpbar')" v-model="form.tpbar" @blur="blurFunction"
							placeholder="请输入托盘号" />
						<u-button size="mini" shape="circle" @click="scan1('form.tpbar')">扫描</u-button>
					</u-form-item>
					<u-form-item label="上架数量" label-width="170" right-icon="">
						<u-input @click="changeScanInput('sjAmouont')" v-model="sjAmouont" type="number"
							@blur="blurFunction" placeholder="请输入数量" />
					</u-form-item>
					<u-form-item label="卷数" label-width="170" right-icon="">
						<u-input @click="changeScanInput('form.iv_nls')" v-model="form.iv_nls" type="number"
							@blur="blurFunction" placeholder="请输入卷数" />
					</u-form-item>

				</u-form>
				<!-- pda现实的数量会很拥挤,这里加点 -->
				<!-- <view style="margin: 200rpx;"></view> -->
				<view v-show="showHeight" style="margin: 360rpx;"></view>
				<!-- <u-gap height="20" bg-color="#f5f5f5"></u-gap> -->
			</view>
			<!-- </uni-card> -->
			<!-- </uni-section> -->

		</view>
		<u-row v-if="current === 1 " gutter="32" class="more-bottom-box" justify="center">
			<u-col span="10">
				<view><u-button :disabled="!mxList.length" class="more-button" type="primary" shape="circle"
						@click="submitIn('returnSearch')">上架并返回筛选</u-button>
				</view>
			</u-col>
			<u-col span="10">
				<view><u-button :disabled="!mxList.length" class="more-button" type="primary" shape="circle"
						@click="submitIn()">上架</u-button>
				</view>
			</u-col>
		</u-row>
		<view v-if="current === 2" style="padding-bottom: 120rpx;">


			<u-form :model="form">


				<InHead v-if="refreshInHead" :hzData="hzData">
				</InHead>
				<!-- <ImportMsg>
						</ImportMsg>
						<HzMsg>
						</HzMsg> -->
				<MxMsg v-if="refreshMxMsg" :oneMx="oneMx">
				</MxMsg>


			</u-form>
			<!-- <u-row gutter="32" class="more-bottom-box" justify="center">
				<u-col span="10">
					<view>
						<u-button class="more-button" type="primary" shape="circle"
							@click="scan1('inbillNo')">扫入库单</u-button>
					</view>
				</u-col>
				<u-col span="10">
					<view><u-button class="more-button" type="primary" shape="circle" @click="submitIn">上架</u-button>
					</view>
				</u-col>

			</u-row> -->

		</view>
	</view>
</template>
<script>
	import HeadNavBar from '@/components/headnavbar/index';
	import InHead from '@/components/storage-body/in-head';
	import ImportMsg from '@/components/storage-body/import-msg';
	import HzMsg from '@/components/storage-body/hz-msg';
	import MxMsg from '@/components/storage-body/mx-msg';
	import PdaScan from '@/components/pda/pda-sacn/pda-sacn';
	import ErrDialog from '@/components/err-dialog.vue'

	import myScan from '@/components/pda/pda-sacn/my-scan'
	export default {
		components: {
			myScan,

			HeadNavBar,
			InHead,
			ImportMsg,
			HzMsg,
			MxMsg,
			PdaScan,
			ErrDialog,

		},

		data() {
			return {
				userCode: '',
				// 需要判断是哪个输入框
				scanInput: "",
				scanResult: "",
				scanCodeIsShow: true, //控制监听扫描头 组件重新加载
				errDialogOpen: false,
				// 错误信息
				dialogData: {
					title: '入库',
					msgType: '',
					errContent: '',
					confirmText: '',
					functionName: '',
					cancelText: '',
				},
				keywords: '',
				form: {
					huoz_id: '',
					inbillNo: '',
					itm: '',
					rwid: '',
					landpoint: '',
					tpbar: '',
					scanAll: '',
					iv_nls: '1',
				},
				scanAllFocus: false,
				border: true,
				show: false,
				//库房展示
				kufShow: false,

				// 工作台下拉展示
				gzzShow: false,
				// 当前工作台中文
				gztNowLabel: '',
				GZTID: '',
				kuf: '',
				// 商品相关条件
				goods: '',
				gztList: [],

				// 点位集合
				landpointList: [],
				kufList: [],
				//日历选择显示
				calendaShow: false,
				//有效期日历显示
				calendaEffdateShow: false,
				list: [{
						name: '明细筛选'
					}, {
						name: '明细修改',
					},
					// {
					// 	name: '预览',
					// },
				],
				m2mSimflowList: [],
				m2mOrderFlowList: [],
				current: 0,
				showHeight: false,
				result1: '',
				status: 'nomore',
				iconType: 'circle',
				isDot: false,
				loadText: {
					loadmore: '点击加载更多',
					loading: '正在加载...',
					nomore: '没有更多了'
				},
				// 搜索栏的入库单号
				inbillNo: '',
				nvueWidth: 730,
				only_one: [{
					text: '选择此项',
					value: 0
				}],
				// 基础表单数据
				baseFormData: {
					name: '',
					age: '',
					introduction: '',
					sex: 2,
					hobby: [5],
					datetimesingle: 1627529992399
				},
				hzData: {
					INPAGENO: "",
					INPAGENOYW: "",
					STORAGEID: "",
					INTYPE: "",
					INDATE: ""
				},
				refreshInHead: true,
				refreshMxMsg: true,
				mxList: [

				],

				oneMx: {},
				myIndex: '',
				myCgdNo: '',
				disableTrue: true,
				// 入库点
				landpoint: '',
				sjAmouont: '',
				sjLocation: '',
			}
		},
		onLoad(option) {
			this.form.landpoint = uni.getStorageSync("storage-landpoint")
			if (option) {
				if (option.item) {
					let item = JSON.parse(option.item)
					this.hzData = item
					console.log('收到的:' + JSON.stringify(item))
					console.log('收到的:' + item.INPAGENO)
					this.inbillNo = item.INPAGENO;
					this.getInListOneInfo()
				}
			}
		},

		created() {
			this.refreshScan()
			this.getLandpointList()
			this.init()
			this.changeScanInput("inbillNo")

		},
		// 数据变化适用
		onShow() {
			this.myShow()

		},
		onBackPress() {
			console.log("点击了返回")
			uni.switchTab({
				url: "/pages/sys/workbench/wms-work"
			})
			return true
		},
		methods: {
			scanCode(res) {
				console.log("父scanCode 收到的数据:" + res)
				this.resultCode(res)
			},
			resultCode(res) {
				this.scanResult = JSON.stringify(res)
				this.changeScanValue()
			},


			changeLandpoint(e) {
				// this.form.landpoint = e
				// console.log("e:"+e)
				// uni.setStorageSync("storage-landpoint", e)
				// console.log("线边仓制单缓存作业场景:" + uni.getStorageSync("storage-landpoint"))
				// // 选择后，可以选择线边仓工作站
				// // this.notChangeLine = false
				// // this.getLineGzt()
				// this.showSelector(false)

				this.form.landpoint = e
				uni.setStorageSync("storage-landpoint", e)
				console.log("线边仓制单缓存作业场景:" + uni.getStorageSync("storage-landpoint"))
				// 选择后，可以选择线边仓工作站
				// this.notChangeLine = false
				// this.getLineGzt()
				this.showSelector(false)
			},
			// 下拉内容是否展开
			showSelector(res) {
				console.log(res)
				this.showHeight = res
			},
			retryFunciton() {
				this.submitIn()
			},
			navTo(url) {
				uni.switchTab({
					url: url,
					success: function(e) {
						var page = getCurrentPages().pop(); // 返回页面数组的最后一个页面数据
						if (page == undefined || page == null)
							return; //如果最后一个页面为undefined或null，即当前就在首页 return出去，不调用onLoad
						page.onLoad();
					}
				});


			},
			searchMx() {
				this.getInListOneInfo()
			},
			overStyle(over) {
				if (over) {
					return "text-align: right;color: #58ca93;";
				} else {
					return "text-align: right;color: #f28c03;";
				}
			},
			init() {
				this.GZTID = uni.getStorageSync('IN_GZTID')
				this.kuf = uni.getStorageSync('kuf')
			},
			goTo(item, index) {
				if (item.over) {
					this.$u.toast('已完成入库,请选择其他入库单明细')
					return
				} else {
					let item = this.mxList[index]
					if (this.inbillNo.length > 0) {

					} else {
						// 通过点击明细,输入了入库单号,以及 预览的一些数据
						this.inbillNo = item.INPAGENO
						this.getInListByInbillNo()
					}
					console.log('item:' + JSON.stringify(item))
					item.index = Number(index + 1)
					this.oneMx = item
					this.myIndex = index
					this.myCgdNo = item.INPAGENO + "#" + item.ITM
					console.log('保存过滤条件：' + JSON.stringify(this.myCgdNo))
					// tabs转换到第一个
					this.change(1)
					// 获取焦点并直接扫描
					this.scanAllFocus = true
					this.changeScanInput('form.scanAll')
					this.removeSomeOneMx()

				}

				// let id = item.INPAGENO
				// uni.navigateTo({
				// 	url: 'index?item=' + JSON.stringify(item)
				// });
			},
			// 清空部分明细
			removeSomeOneMx() {
				this.form.scanAll = ''
				// this.oneMx.BATCHNO=''
				// this.oneMx.PRODUCTDATE = ''
				// this.oneMx.EFFDATE = ''
				this.sjAmouont = ''
			},

			getInListByInbillNo() {
				const STORAGE_ID = uni.getStorageSync('STORAGE_ID')
				const huoz_id = "%"
				const USER_ID = uni.getStorageSync('USER_ID')
				const inbillNumber = this.inbillNo ? this.inbillNo : "%"

				const unit = "%"
				const goodsId = "%"
				const palletNumber = "%"
				let param = STORAGE_ID + "," + huoz_id + "," + USER_ID + "," +
					inbillNumber + "," + unit + "," + goodsId + "," + palletNumber;
				console.log("iv_parm:" + param)
				this.$u.api.general({
						iv_code: "PDAINBILLINPAGENO",
						iv_parm: param
					})
					.then(res => {
						// console.log("返回的res:" + JSON.stringify(res))
						let data = res.data
						console.log("返回的data:" + JSON.stringify(data))
						if (res.success) {
							this.hzData = data[0]
							// if (this.list.length < 1) {
							// 	this.$u.toast("没有查到数据");
							// }
						} else {
							this.$u.toast(res.msg);
						}
					});
			},
			//重新加载子组件
			myShow() {

				console.log("this.hzData==>" + JSON.stringify(this.hzData))
				//刷新显示
				let that = this;
				that.refreshInHead = false;
				that.$nextTick(() => {
					that.refreshInHead = true;
				})

			},
			// 刷新扫描组件
			refreshScan() {
				this.scanCodeIsShow = false;
				this.$nextTick(() => {
					this.scanCodeIsShow = true;
				})
			},
			myMxShow() {
				//刷新显示
				let that = this;
				that.refreshMxMsg = false;
				that.$nextTick(() => {
					that.refreshMxMsg = true;
				})

			},
			errDialogShow() {
				console.log("刷新显示提示框")
				//刷新显示
				let that = this;
				that.errDialogOpen = false;
				that.$nextTick(() => {
					that.errDialogOpen = true;
				})

			},
			resolutionScan() {
				console.log("解析")
				let scanResult = this.form.scanAll

				if (scanResult.match("&&")) {

					if (scanResult) {
						let result = scanResult.split("&&")
						// 物料编码
						let goodsId = result[0]
						// 物料名称
						let gdname = result[1]
						// 供应商代码
						let gysId = result[2]
						// 物料批次
						let itemid = result[3]
						// 订单号
						let inbillno = result[4]
						// 数量
						let amount = Number(result[5])
						// 出场检验日期
						let productdate = result[6]

						if (goodsId) {
							if (goodsId !== this.oneMx.GDSEQ) {
								this.$u.toast('扫描内容与当前商品id不对应');
								return
							}
						}
						this.oneMx.PRODUCTDATE = productdate ? productdate : ''
						// this.oneMx.BZQ = 2
						if (this.oneMx.BZQ) {
							const _this = this
							var date1 = productdate;
							var date2 = new Date(date1);
							date2.setMonth(Number(date1.split("-")[1]) + Number(this.oneMx.BZQ));

							// var dateBegin = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate()
							var dateEnd = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate()
							// console.log(dateBegin );
							// console.log(dateEnd);
							this.oneMx.EFFDATE = dateEnd
						} else {
							this.$u.toast('保证期(bzq为空),扫描赋值有效期错误');
						}
						this.oneMx.BATCHNO = itemid ? itemid : '0'

						console.log("amount:" + amount)

						// 输入框的数量
						this.sjAmouont = amount ? amount : '0'

					}
				}
			},
			scan1(param) {
				console.log("扫描")
				// #ifdef H5
				this.$u.toast('H5页面不支持扫码,请用安卓等移动设备重试')
				// #endif
				let that = this;
				// 允许从相机和相册扫码
				uni.scanCode({
					success: function(res) {
						if (param == "inbillNo") {
							that.inbillNo = res.result;
						} else if (param == "LOCATIONZD") {
							that.sjLocation = res.result
						} else if (param == "form.tpbar") {
							that.form.tpbar = res.result
						} else if (parm == "form.scanAll") {
							that.form.scanAll = res.result
						}

					}
				});
			},
			change(index) {
				console.log(this.current)
				this.current = index;
			},
			submit(index) {
				if (this.inbillNo) {
					this.$u.toast('调用上架接口')
				} else {
					this.$u.toast('请补充入库单号的数据')
				}
			},
			submitIn(paramReturn) {
				// 1、IV\_STORAGEID 仓库编号,
				// 2、IV\_GZTID 工作台
				// 3、IV\_USER\_ID 用户编号
				// 4、IV\_INPAGENO 入库单号
				// 5、IV\_ITM 行号
				// 6、IV\_BATCHNO 批号
				// 7、IV\_PRODUCTDATE 生产日期
				// 8、IV\_EFFDATE 有效期
				// 9、IV\_PRODUCTDATE\_PRINT 打印生产日期
				// 10、IV\_EFFDATE\_PRINT 打印有效日期
				// 11、IN\_AMOUNT 数量
				// 12、IV\_TPBAR 托盘号
				// 13、IV\_LOCATION 指定货位
				// 14、IV\_GOODSTATUS 质量状态
				// 15、IV\_KUB 库别
				// 16、IV\_KUF\_NO 库房
				// 17、IV\_QUY\_NO 区域
				// 18、IV\_UNIQUECODE 唯一码
				// 19、IV\_BGZID 保管账：默认1
				// 20、IV\_NLS 内联数
				// 21、IV\_YWZT 业务状态
				const STORAGE_ID = uni.getStorageSync('STORAGE_ID')
				const GZTID = this.GZTID ? this.GZTID : "%"
				const USER_ID = uni.getStorageSync('USER_ID')
				const inbillNo = this.inbillNo ? this.inbillNo : "%"
				console.log("单号:" + inbillNo)
				const ITM = this.oneMx.ITM ? this.oneMx.ITM : "%"
				const BATCHNO = this.oneMx.BATCHNO ? this.oneMx.BATCHNO : "%"

				const PRODUCTDATE = this.oneMx.PRODUCTDATE ? this.oneMx.PRODUCTDATE : "%"
				const EFFDATE = this.oneMx.EFFDATE ? this.oneMx.EFFDATE : "%"
				const PRODUCTDATE_PRINT = PRODUCTDATE
				const EFFDATE_PRINT = EFFDATE

				//200
				const sjAmouont = this.sjAmouont ? this.sjAmouont : ""
				if (!sjAmouont) {
					this.$u.toast('请填写上架数量')
					return;
				}
				//本次入库数量上限
				const MaxAmount = Number(this.oneMx.AMOUNT - this.oneMx.SHIS_AMOUNT)
				if (Number(MaxAmount - this.sjAmouont) < 0) {
					this.$u.toast('超出本明细数量上限! 数量上限:' + MaxAmount)
					return;
				}
				console.log("数量上限:" + MaxAmount)
				//0
				const TPBAR = this.form.tpbar
				if (!TPBAR) {
					this.$u.toast('请填写托盘号')
					return;
				}
				//空
				const sjLocation = this.sjLocation ? this.sjLocation : ""
				//1
				const GOODSTATUS = 1
				//%
				const KUB = this.oneMx.KUB ? this.oneMx.KUB : "%"
				// YCQ
				const KUF_NO = this.kuf ? this.kuf : "%"
				//%
				const QUY_NO = this.oneMx.QUY_NO ? this.oneMx.QUY_NO : "%"
				//0
				const UNIQUECODE = this.oneMx.UNIQUECODE ? this.oneMx.UNIQUECODE : "0"
				//1
				const BGZID = this.oneMx.BGZID ? this.oneMx.BGZID : "1"
				//1
				const NLS = this.form.iv_nls ? this.form.iv_nls : "1"
				//01
				const YWZT = this.oneMx.YWZT ? this.oneMx.YWZT : "01"
				//DHJ01
				const landpoint = this.form.landpoint

				if (!landpoint || landpoint === "%") {
					this.$u.toast('请选择入库点')
					return;
				}

				let param = STORAGE_ID + "," +
					GZTID + "," +
					USER_ID + "," +
					inbillNo + "," +
					ITM + "," +
					BATCHNO + ","

					+
					PRODUCTDATE + "," +
					EFFDATE + "," +
					PRODUCTDATE_PRINT + "," +
					EFFDATE_PRINT + ","

					+
					sjAmouont + "," +
					TPBAR + "," +
					sjLocation + "," +
					GOODSTATUS + ","

					+
					KUB + "," +
					KUF_NO + "," +
					QUY_NO + ","

					+
					UNIQUECODE + "," +
					BGZID + "," +
					NLS + "," +
					YWZT + "," +
					landpoint;

				console.log("iv_parm:" + param + ";")
				let that = this
				this.$u.api.prcutlexecvar({
						iv_code: "PDAINBILLSH",
						iv_parm: param,
						ov_var1: '2',
						ov_var2: '2',
						ov_var3: '2',
						ov_var4: '2',
						ov_var5: '2',
					})
					.then(res => {
						console.log("返回的res:" + JSON.stringify(res))
						// that.$u.toast(res.msg);
						// that.$refs.uToast.show({
						// 					title: res,
						// 					type: 'info',

						// 				})

						if (res.success) {
							that.$u.toast(res.msg);
							let data = res.data
							// console.log("返回的data:" + JSON.stringify(data))
							console.log("返回的res.msg:" + res.msg)
							//补充text
							// this.actionSheetList = data.map(v => {
							// 	this.$set(v, 'text', v
							// 		.STORAGE_NAME) // https://vuejs.org/v2/guide/reactivity.html
							// 	return v
							// })
							// this.list = data
							// this.mxList = data
							// // 刷新明细数据展示
							// this.myMxShow()

							// // 默认选择一个明细
							// this.goTo(0)
							//成功后 上架数量归为1
							this.submitSuccess()
							if (paramReturn == "returnSearch") {
								//回到明细列表
								this.current = 0
							}
							//直接点击第一个
							// this.goTo(0,0)
							// this.getNextMx()
						} else {

							this.dialogData = {
								title: '入库失败',
								msgType: 'error',
								errContent: res.msg,
								confirmText: '重新提交入库',
								functionName: 'submitIn',
								cancelText: '关闭',
							}
							this.errDialogShow()
						}

					});
			},
			dialogToggle() {
				console.log("open!!!")
				this.$refs.errDialog.open()
			},
			testErrdialog() {

				// this.dialogToggle()
				this.dialogData = {
					title: '入库失败',
					msgType: 'error',
					errContent: "我是一个错误的提示信息模拟",
					confirmText: '重新提交入库',
					functionName: 'submitIn',
				}

				this.errDialogShow()
			},
			submitSuccess() {
				//landpoint:'',
				// sjAmouont:'1',
				// sjLocation:'',

				this.sjLocation = ''
				this.form.tpbar = ''




				//重新搜索一下
				this.searchMx()
				const that = this
				setTimeout(function() {
					that.removeSomeOneMx()
				}, 1000)
				// 不需要

			},
			// 获取并执行下一条明细数据
			getNextMx() {
				const now = this.oneMx.index
				const total = this.oneMx.total
				// 是否所有循环都结束
				const allOver = false
				let oneOver = false
				//循环所有
				for (let i = 0; i < total; i++) {
					oneOver = this.mxList[i].over
					// 如果未执行,那么就可以准备出库,执行, 并结束循环
					if (!oneOver) {
						this.goTo(1, i)
						return;
					}
				}

			},
			navTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			getInListOneInfo() {
				//1、IV\_STORAGEID 仓库id,
				// 2、IV\_YEZ\_ID 业主id
				// 3、IV\_USER\_ID 用户id
				// 4、IV\_INPAGENO 入库单号
				// 5、IV\_ITM 行号
				// 6、IV\_DWID 单位编号
				// 7、IV\_GOODS 商品信息（编号，六九码，%）
				// 8、IV\_TPBAR 托盘号
				const STORAGE_ID = uni.getStorageSync('STORAGE_ID')
				if (!STORAGE_ID) {
					this.$u.toast('请返回到工作台上方选择分仓，然后再次尝试搜索')
					return
				}
				// const USER_GH = uni.getStorageSync('USER_GH')
				const yez_id = this.form.huoz_id ? this.form.huoz_id : "%"
				const USER_ID = uni.getStorageSync('USER_ID')
				const inpageno = this.inbillNo ? this.inbillNo : "%"
				const itm = this.form.itm ? this.form.itm : "%"
				const rwid = this.form.rwid ? this.form.rwid : "%"
				const goodsId = this.goods ? this.goods : "%"
				const tpbar = this.form.tpbar ? this.form.tpbar : "%"
				let param = STORAGE_ID + "," + yez_id + "," + USER_ID + "," +
					inpageno + "," + itm + "," + rwid + "," + goodsId +
					"," + tpbar;
				console.log("iv_parm:" + param)
				let that = this
				this.$u.api.general({
						iv_code: "PDAINBILLDISP",
						iv_parm: param
					})
					.then(res => {
						// console.log("返回的res:" + JSON.stringify(res))
						let data = res.data
						// console.log("返回的data:" + JSON.stringify(data))
						if (res.success) {
							//补充text
							this.mxList = data.map(v => {
								this.$set(v, 'over', false) // https://vuejs.org/v2/guide/reactivity.html
								this.$set(v, 'index', 0)
								this.$set(v, 'total', data.length)
								return v
							})
							// this.list = data
							// this.mxList = data
							// 刷新明细数据展示
							this.myMxShow()

							// 默认选择一个明细
							// this.goTo(0,0)
							// 末尾显示
							this.status = 'nomore';

							// 把明细重新加载一下
							// 清空当前明细
							this.oneMx = []
							// this.oneMx = file
							const filterEd = {}
							const tabs = this.mxList
							const myCgdNo = this.myCgdNo
							console.log('过滤条件：' + JSON.stringify(this.myCgdNo))

							// this.oneMx = tabs.filter(tab => {
							// 	console.log('每条过滤条件'+tab.INPAGENO + '#' + tab.ITM)
							// 	console.log('每条过滤条件this.myCgdNo:'+this.myCgdNo)
							// });
							this.oneMx = tabs.filter(tab =>
								tab.INPAGENO + '#' + tab.ITM == myCgdNo
							);
							console.log('过滤后的查询：' + JSON.stringify(this.oneMx))
							if (this.oneMx.length > 0) {
								this.oneMx = this.oneMx[0]
							} else {
								// this.$u.toast("暂无数据");
							}


						} else {
							this.$u.toast(res.msg);
						}
					});
			},
			hello(hello) {
				// this.$u.toast(hello)
			},
			// 判定点击的哪个输入框
			changeScanInput(inputItem) {
				this.refreshScan()
				// this.$u.toast(inputItem)
				console.log(inputItem)
				this.scanInput = inputItem
			},
			// 扫描后执行的方法,判断输入框并绑定值,可以自行跳转,或者扫描完执行某方法,
			changeScanValue() {
				let scanInput = this.scanInput
				let result = JSON.parse(this.scanResult)
				if ("form.tpbar" === scanInput) {
					console.log("this.form.tpbar ")
					this.form.tpbar = result
				} else if ("sjAmouont" === scanInput) {
					console.log("this.sjAmouont")
					this.sjAmouont = result
				} else if ("inbillNo" === scanInput) {
					console.log("this.inbillNo")
					this.inbillNo = result
					this.searchMx()
					//form.scanAll
				} else if ("form.iv_nls" === scanInput) {
					console.log("this.form.iv_nls")
					this.form.iv_nls = result

					//form.iv_nls
				} else if ("form.scanAll" === scanInput) {
					console.log("this.form.scanAll")
					this.form.scanAll = result

				} else {
					// this.$u.toast('没有预先适配:' + scanInput)
					console.log('没有预先适配:' + scanInput)
				}
			},
			blurFunction() {
				console.log("失去了焦点")
				this.myMxShow()
			},
			changeProductDate(e) {
				console.log("选择的日期:" + JSON.stringify(e))
				this.oneMx.PRODUCTDATE = e.result
				this.myMxShow()
			},
			changeEFFDATE(e) {
				this.oneMx.EFFDATE = e.result
				this.myMxShow()
			},
			changeGzt(index) {
				// 表层文字
				this.gztNowLabel = this.gztList[index].text;
				uni.setStorageSync('gztNowLabel', this.gztNowLabel)

				// id
				const GZTID = this.gztList[index].GZTID == "%" ? '' : this.gztList[index].GZTID;
				if (GZTID) {
					this.GZTID = GZTID
					uni.setStorageSync('IN_GZTID', GZTID)

				} else {
					this.GZTID = ''
					uni.removeStorageSync('IN_GZTID')
				}
				console.log("缓存中的入库工作站IN_GZTID:" + uni.getStorageSync('IN_GZTID'))

			},
			changeKuf(index) {
				// 表层文字
				// this.gztNowLabel = this.gztList[index].text;
				// uni.setStorageSync('gztNowLabel', this.gztNowLabel)

				// id
				const KUF_NO = this.kufList[index].KUF_NO == "%" ? '' : this.kufList[index].KUF_NO;
				console.log('选中的库房号:' + KUF_NO)
				if (KUF_NO) {
					this.kuf = KUF_NO
					uni.setStorageSync('kuf', KUF_NO)

				} else {
					this.kuf = ''
					uni.removeStorageSync('kuf')
				}
				console.log("缓存中的库房kuf:" + uni.getStorageSync('kuf'))

			},
			getLandpointList(loginType) {
				// const user_id = uni.getStorageSync('USER_ID')
				const STORAGE_ID = uni.getStorageSync('STORAGE_ID')
				const type = "1"

				let param = STORAGE_ID + "," + type
				console.log(param)
				this.$u.api.general({
						iv_code: "GETSXCSKLD",
						iv_parm: param
					})
					.then(res => {
						// console.log("返回的res:" + JSON.stringify(res))
						let data = res.data
						console.log("点位集合返回的data:" + JSON.stringify(data))
						if (res.success) {
							//补充text
							this.landpointList = data.map(v => {
								this.$set(v, 'text', v
									.DOCK_LANDMARKID
								)
								this.$set(
									v, 'value', v.DOCK_LANDMARKID
								)
								return v
							})
						} else {
							this.$u.toast(res.msg);
						}
					});
			},
			getGzt(loginType) {
				const user_id = uni.getStorageSync('USER_ID')
				const STORAGE_ID = uni.getStorageSync('STORAGE_ID')
				const kuf = "%"
				const gztType = "1"
				const gztId = "%"
				let param = user_id + "," + STORAGE_ID + "," + kuf + "," + gztType + "," + gztId;
				console.log(param)
				this.$u.api.general({
						iv_code: "GETGZTINFO",
						iv_parm: param
					})
					.then(res => {
						// console.log("返回的res:" + JSON.stringify(res))
						let data = res.data
						console.log("返回的data:" + JSON.stringify(data))
						if (res.success) {
							//补充text
							this.gztList = data.map(v => {
								this.$set(v, 'text', v
									.GZTNAME + "(" + v.GZTID + ")"
								) // https://vuejs.org/v2/guide/reactivity.html
								return v
							})
						} else {
							this.$u.toast(res.msg);
						}
					});
			},
			getKuf(loginType) {
				const USER_ID = uni.getStorageSync('USER_ID')
				const KUB = '%'
				const KUF_NO = "%"
				const GET_TYPE = "2"
				let param = USER_ID + "," + KUB + "," + KUF_NO + "," + GET_TYPE;
				console.log(param)
				this.$u.api.general({
						iv_code: "GETKUFQUYNO",
						iv_parm: param
					})
					.then(res => {
						// console.log("返回的res:" + JSON.stringify(res))
						let data = res.data
						console.log("kuf返回的data:" + JSON.stringify(data))
						if (res.success) {
							//补充text
							this.kufList = data.map(v => {
								this.$set(v, 'text', v
									.KUF_NO
									// +"("+v.GZTID+")"
								) // https://vuejs.org/v2/guide/reactivity.html
								return v
							})
						} else {
							this.$u.toast(res.msg);
						}
					});
			},
		}

	}
</script>
<style lang="scss" scoped>
	@import 'index.scss';
	@import '../../common/base-change.scss';

	page {
		background-color: #f5f5f5;
	}

	.wrap {
		padding-bottom: 120rpx;
	}

	.wrap .search {
		background: #ffffff;
	}

	.apply-text {
		font-size: 28rpx;
		color: #333333;

		span {
			color: #999999;
		}
	}

	.user-images {
		width: 28px;
		height: 28px;
		margin-right: 8px;
	}

	.apply-list-foot {
		font-size: 28rpx;
	}

	.personnel-list {
		display: flex;
		align-items: center;
		flex-wrap: wrap;

		.personnel-user {
			position: relative;
			margin: 5px 9px 0;
		}

		.user-images {
			width: 48px;
			height: 48px;
			margin-right: 0;

		}

		.iconfont {
			position: absolute;
			top: -12px;
			right: -5px;
			color: #FE0100;
		}
	}

	.more-button {
		margin-top: 35rpx;
		// margin-bottom:15rpx;
	}

	.example-body {
		padding: 15rpx 30rpx 4rpx 30rpx;
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		// padding: 15rpx 10rpx 0 10rpx;

		overflow: hidden;
		// height: 380rpx;
	}
</style>